package com.karolak.stock.strategy;

import java.util.ArrayList;
import java.util.List;

import com.karolak.stock.indicator.FftInd;
import com.karolak.stock.indicator.HorizontalInd;
import com.karolak.stock.indicator.Indicator;
import com.karolak.stock.oscilator.DeltaOsc;
import com.karolak.stock.oscilator.DiffOsc;

public class TrendStrategy extends Strategy {

	@Override
	protected String defineConfig() {
		return "{signalThreshold:0.0001,votingThreshold:0.7,period:12,periodMultipliers:[1,5,25]}";
	}

	@Override
	protected List<Indicator> defineVoters() {

		String chBase = "base";
		String chDelta = "delta";
		String chDiff = "diff";

		List<Indicator> voters = new ArrayList<Indicator>();

		Indicator price = getDataManager().addSeries(new Indicator("Price", getDataManager()), chBase);

		Indicator fft2 = getDataManager().addSeries(new FftInd(getDataManager(), getConfig().getFftPeriod(), price, 2), chBase);

		HorizontalInd h1 = getDataManager().addSeries(new HorizontalInd(getConfig().getSignalThreshold()), chDelta);
		HorizontalInd h2 = getDataManager().addSeries(new HorizontalInd(-getConfig().getSignalThreshold()), chDelta);

		DiffOsc diffFft2 = getDataManager().addSeries(new DiffOsc(getDataManager(), getConfig().getFftPeriod(), price, fft2), chDelta);
		DeltaOsc delFft2 = getDataManager().addSeries(new DeltaOsc(getDataManager(), fft2, getConfig().getFftPeriod(), getConfig().getSignalThreshold()), chDelta);

		voters.add(diffFft2);
		voters.add(delFft2);

		return voters;
	}
}
